void main() {
  Person p = Person(name: '小张');
  p.eat();

  Teacher t = Teacher(name: '冷锋');
  t.eat();
}

//人
class Person with PersonUtil, PersonStudy {
  String? name;
  int? age;
  int? weight;

  Person({this.name, this.age, this.weight}) {}

  eat() {
    print('$name在吃饭');
    this.study(this.name!);
  }

  run() {
    print('$name在跑步');
  }
}

//老师
class Teacher extends Person with PersonUtil, PersonStudy {
  Teacher({
    String? name,
    int? age,
    int? weight,
  }) : super(name: name, age: age, weight: weight);

  @override
  eat() {
    // TODO: implement eat
    super.eat();
    print('$name吃完饭去散步了');
    this.doHouseWork(this.name!);
    this.study(this.name!);
  }
}

//学生
class Student extends Person with PersonUtil, PersonStudy {
  Student({
    String? name,
    int? age,
    int? weight,
  }) : super(name: name, age: age, weight: weight);

  @override
  eat() {
    // TODO: implement eat
    super.eat();
    print('$name吃完饭去散步了');
    this.doHouseWork(this.name!);
    this.study(this.name!);
  }
}

mixin PersonUtil {
  doHouseWork(String name) {
    print('$name在做家务');
  }
}

mixin PersonStudy {
  study(String name) {
    print('$name在学习');
  }
}
